<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>

<head><title>Electronic Library</title></head>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="5">
    <tr>
        <th width="4%">No</th>
        <th width="17%">Filename</th>
        <th width="17%">Name</th>
        <th width="17%">Author</th>
        <th width="17%">Publishing</th>
        <th width="20%">Description</th>
        <th width="20%">&nbsp;</th>
    </tr>
    <c:choose>
        <c:when test="${books != null}">
            <c:forEach var="book" items="${books}" varStatus="counter">
                <tr>
                    <td>${counter.index + 1}</td>
                    <td>${book.filename}</td>
                    <td>${book.bookName}</td>
                    <td>${book.bookAuthor}</td>
                    <td>${book.bookPublishing}</td>
                    <td>${book.bookDescription}</td>
                    <td>
                        <div align="center"><a href="download.htm?id=${book.id}">Download</a> /
                            <a href="delete.htm?id=${book.id}">Delete</a></div>
                    </td>
                </tr>
            </c:forEach>
        </c:when>
    </c:choose>
</table>


<h2>Add New Book</h2>

<form action="upload.htm" method="post" enctype="multipart/form-data">
    <table width="60%" border="1" cellspacing="1">
        <tr>
            <td width="35%"><strong>File to upload</strong></td>
            <td width="65%"><input type="file" name="file"/></td>
        </tr>
        <tr>
            <td><strong>Book Name</strong></td>
            <td><input type="text" name="bookName" width="80"/></td>
        </tr>
        <tr>
            <td><strong>Book Author</strong></td>
            <td><input type="text" name="bookAuthor" width="80"/></td>
        </tr>
        <tr>
            <td><strong>Book Publishing</strong></td>
            <td><input type="text" name="bookPublishing" width="80"/></td>
        </tr>
        <tr>
            <td><strong>Book Description</strong></td>
            <td><input type="text" COLS=40 ROWS=6 name="bookDescription" width="60"/></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="submit" value="Add"/></td>
        </tr>
    </table>
</form>
</body>
</html>